package cym.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import cym.controller.service.interfaces.LocalService;
import cym.service.interfaces.DemoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by chenyiming on 2017/8/10.
 */

@Controller
@RequestMapping("/test")
public class HelloWorldController {

    private static final Logger LOGGER = LoggerFactory.getLogger(HelloWorldController.class);

    @Reference
    private DemoService demoService;

    @Autowired
    private LocalService localService;

    @RequestMapping(value = "/hello.do")
    @ResponseBody
    public String hello() {
        LOGGER.info("hello.do");
        return demoService.test("HELLO");
    }

    @RequestMapping(value = "/world.do")
    @ResponseBody
    public String world() {
        LOGGER.info("world.do");
        return localService.local("WORLD");
    }


}
